<div id="inbox-display-area">
	<form action="<?php echo $config_file['web_root']?>/php/admin/inbox_admin.php" method="post" onsubmit="AjaxFormPost.send(this,inboxUpdatePostCallback); return false;">
		<input type="hidden" name="func" id="func">
		<input type="hidden" name="email_id" id="email-id">
	<div id="nav-top"></div>
	<div class="page-spanner">
		<table width="100%" cellspacing="0">
			<tr>
				<td class="table-header table-header-leftmost" align="center" width="5%">
					<input type="submit" id="submit-button" class="active" onclick='setDeleteFunction(); inactivate(this);' value='Delete'>
				</td>
				<td class="table-header" align="center" width="25%">From</td>
				<td class="table-header" align="center" width="20%">Date/Time</td>
				<td class="table-header" align="center" width="40%">Subject</td>
				<td class="table-header" align="center" width="10%">Show/Hide</td>
			</tr>
			<tbody id="email-list"></tbody>
		</table>
	</div>
	<div id="email-load-msg">
		<p align="center"><img src="<?php echo $config_file['web_root']?>/images/ajax-loader-tb.gif" border="0"></p>
		<p align="center">Loading emails</p>
	</div>
	
	<div class="page-spanner">
		<p align="left"><div class="clickable left" onclick="document.getElementById('email-list').innerHTML = ''; Paginator.go(1)"><img src="../../images/refresh.gif" width="12px" border="0" title="Check for new mail."></div></p>
	</div>
	<div id="nav-bottom"></div>
	</form>
</div>
<script type="text/javascript">
var params = new Array();
params["func"] = "L";
var url = "<?php echo $config_file['web_root']?>/php/admin/inbox_admin.php";
Paginator.store(url,params,inboxLoaderCallback);
Paginator.go(1);

function setDeleteFunction() {
	document.getElementById("func").value = "D";
	var ids = null;
	var id_count = 0;
	if (document.forms[0].emailid.length == undefined) {
		if (document.forms[0].emailid.checked) {
			ids = document.forms[0].emailid.value;
			id_count=1;
		}
	} else {
		for (var i = 0; i < document.forms[0].emailid.length; i++) {
			if (document.forms[0].emailid[i].checked) {
				if (id_count == 0) ids = document.forms[0].emailid[i].value;
				else ids+= "," + document.forms[0].emailid[i].value;
				id_count++;
			}
		}
	}
	document.getElementById("email-id").value = ids;
}
</script>
